import os
from building import * 
import rtconfig

# get current dir path
cwd = GetCurrentDir()

# init src and inc vars
src = []
inc = []

# add lvgl_app common include
inc = inc + [cwd]

# add lvgl_app basic code
src = Glob('*.c')

LOCAL_CCFLAGS = ''

if rtconfig.CROSS_TOOL == 'gcc':
    LOCAL_CCFLAGS += ' -std=c99'
elif rtconfig.CROSS_TOOL == 'keil':
    LOCAL_CCFLAGS += ' --c99 --gnu -g -W'

#group = DefineGroup('lvgl_app', src, depend = [''], CPPPATH = inc, LOCAL_CCFLAGS = LOCAL_CCFLAGS)
#Return('group')

objs = DefineGroup('lvgl_app', src, depend = [''], CPPPATH = inc, LOCAL_CCFLAGS = LOCAL_CCFLAGS)

list = os.listdir(cwd)
for d in list:
    path = os.path.join(cwd, d)
    if os.path.isfile(os.path.join(path, 'SConscript')):
        objs = objs + SConscript(os.path.join(d, 'SConscript'))

Return('objs')

